#!/bin/bash

ulimit -n 10240


mkdir -p /data/hadoop/tmp /opt/opentsdb
node=${hostname}

echo "current node: ${node} ,role ${node_role}"

/usr/sbin/sshd

[[ ! -e "/data/hadoop/init.done" ]] && /opt/hadoop/bin/hadoop namenode -format && touch /data/hadoop/init.done

/opt/hadoop/sbin/start-all.sh

${HBASE_HOME}/bin/start-hbase.sh

if [[ ! -e /opt/opentsdb/init.done ]]
then
    #/opt/opentsdb/src/create_table.sh   
    /usr/share/opentsdb/tools/create_table.sh && touch /opt/opentsdb/init.done
fi

echo "########### Start Open TSDB ###########"
tsdb tsd --config=/usr/share/opentsdb/etc/opentsdb/opentsdb.conf
echo "########################################"

tail -f 